<?php $this->load->library("urlutility");?>
<style>
#prev {
	margin-top:-313px;
}
#next {
	margin-top:-313px;
}
</style>
<script type="text/javascript" language="javascript">
	$(function() {
		$('#prev').addClass('hide');
		$('#next').addClass('hide');
		$('#foo0').carouFredSel({
			auto:{pauseOnHover: 'resume'},
			scroll:1,
			prev: '#prev',
			next: '#next',
		});
		$('.list_carousel').mouseover(function(){
			$('#prev').removeClass('hide');
			$('#next').removeClass('hide');						  
		});
		$('.list_carousel').mouseout(function(){
			$('#prev').addClass('hide');
			$('#next').addClass('hide');						  
		});
	});
</script>
<?php if(count($listbanner)>0){?>
<div class="list_carousel ov_fl_hidden h277">
  <ul id="foo0" class="h277">
    <?php foreach($listbanner as $banner){
		if(count($banner)>0){?>
    <li> <a href="<?php echo $this->urlutility->getrestaurant($banner[0]['restaurantid']);?>" class="item ov_fl_hidden"> <img width="886" height="370" class="fl bder_t1_8fa8bc" src="<?php echo base_url()."uploads/restaurantbanner/".$banner[0]['avatar']; ?>"/> </a> </li>
    <?php }}?>
  </ul>
  <a href="javascript:void(0);" id="prev" class="fl"><img src="<?php echo base_url(); ?>public/images/btn_prev.gif"/></a> <a href="javascript:void(0);" id="next" class="fr"><img src="<?php echo base_url(); ?>public/images/btn_next.gif"/></a> </div>
<?php }?>
<div class="fl w660">
  <h1 class="orange item ff_museo700 mgb0 txt_indent20">Restaurant Search Result</h1>
  <div class="item bder_d5 txt_indent20 pdt5 pdb5">
    <div class="fl">10 of <?php echo count($total); ?> show&nbsp;&nbsp;
      <input type="text" placeholder="Name" id="restaurant_namesearch" class="bder_d5 w153" value=""/>
      <input type="button" id="btnsearch_restaurant_name" class="bder_d5 cursor_poiter btn_submit_search" value=" ">
      <?php
		$restaurant_namesearch="";
		for($i=0;$i<count($data);$i++){
			if($i!=(count($data)-1)) $restaurant_namesearch.= '"'.$data[$i]['name'].'",';
			else $restaurant_namesearch.= '"'.$data[$i]['name'].'"';			
		}?>
    </div>
    <div class="fr"><img width="10" height="15" onclick="LeftClick3('spnumberpage','sptotalpage','boxoutsize');" src="<?php echo base_url(); ?>public/images/arrow_01.jpg" class="fl cursor_poiter mgt4 mgr-15 pst_relative zindex10"><span class="fl gray f18 mgl-5"><span  id="spnumberpage">1</span>&nbsp;/&nbsp;<span id="sptotalpage"><?php echo ceil(count($total)/10); ?></span>&nbsp;</span><img width="10" height="15" onclick="RightClick3('spnumberpage','sptotalpage','boxoutsize','getajax_hotel_search_result',listroomhotel,'<?php if(isset($_GET['provide'])) echo $_GET['provide'];else echo $_GET['name'] ?>');" src="<?php echo base_url(); ?>public/images/arrow_01.jpg" class="fl cursor_poiter mgt4 pst_relative zindex10 tran_180deg"></div>
    <div class="fr pdr44 pdt3">Sort by&nbsp;&nbsp;
      <select class="f11 gray bder_d5" id="sortby" onchange="searchbyrestaurant('sortby');">
        <option value="bestdeal">Best deal</option>
        <option value="priceforbreakfast">Price</option>
        <option value="recommendations">Our recommendations</option>
      </select>
    </div>
  </div>
  <div class="item" style="overflow:hidden;">
    <div class="item pst_relative zindex10" id="boxoutsize">
      <div class="fl w660" id="box_inside1">
        <?php 
		 foreach($data as $list){?>
        <div class="item bder_b1_d5 pdt12 pdb10">
          <h3 class="blue ff_museo700 f16 mgt0 pdl10 lheight23 cap mgb10"><?php echo $list["name"]; ?> <br />
            <em class="ff_museo500 gray f13 lighter cap"><?php echo $list["provide"]; ?></em></h3>
          <a href="<?php echo $this->urlutility->getrestaurant($list['id']);?>"><img width="97" height="75" src="<?php echo base_url()."uploads/restaurant/".$list["avatar"]; ?>" alt="<?php echo "Best of Myanmar - ".$list["name"]." - ".$list["provide"]." - ".$list["address"]; ?>" title="<?php echo "Best of Myanmar - ".$list["name"]." - ".$list["provide"]." - ".$list["address"]; ?>" class="fl mgr8 pdl10"/></a>
          <div class="fl w273 pdr20"> <strong class="black"><?php echo $list["cuisinetype"] ?></strong><br>
            <span class="black"><?php echo $list["promotion"]; ?>
            <!-- ... <a href="<?php echo $this->urlutility->getrestaurant($list['id']);?>" class="blue">more »</a>-->
            </span> </div>
          <div class="fr w60 txt_center f11 ff_museo500"><strong class="f14 linethrought">&nbsp;$
            <?php if(isset($list["oldprice"])==NULL)echo '0';else echo $list["oldprice"] ?>
            &nbsp;</strong><br>
            <strong class="f18 orange">
            <?php if(isset($list["pricefordinner"])==NULL) echo "N/A"; else echo $list["pricefordinner"] ?>
            $</strong><br>
            for 1 pax <a class="item ff_museo500 bgr_143167 white pdt3 pdb3 f14 mgt4 cursor_poiter" href="<?php echo $this->urlutility->getrestaurant($list['id']);?>">Details</a> </div>
        </div>
        <?php }?>
      </div>
    </div>
  </div>
  <div class="item pdt16 pdb16">
    <div class="fr"> <img width="10" height="15" class="fl bder_d5 fl pdt4 pdb4 pdl7 pdr9 mgl5 cursor_poiter" onclick="LeftClick3('spnumberpage','sptotalpage','boxoutsize');" src="<?php echo base_url(); ?>public/images/arrow_01.jpg">
      <?php for($i=1;$i<=ceil(count($total)/10);$i++){?>
      <div id="divpager<?php echo $i ?>" class="bder_d5 fl pdt4 pdb4 txt_center w24 mgl5 black cursor_poiter" onclick="loaddata('<?php echo $i ?>','boxoutsize',postdata,'spnumberpage','sptotalpage','getajax_hotel_search_result',listroomhotel);"><?php echo $i ?></div>
      <?php
	}?>
      <img width="10" height="15" class="fl bder_d5 fl pdt4 pdb4 pdl9 pdr7 mgl5 cursor_poiter" src="<?php echo base_url(); ?>public/images/arrow_03.png" onclick="RightClick3('spnumberpage','sptotalpage','boxoutsize','getajax_hotel_search_result',listroomhotel);"> </div>
  </div>
</div>
<div class="fr w193 pdt10">
  <div class="item bgr_gray pdt10">
    <div class="fl pdl10 w173">
      <h3 class="blue ff_museo500 item mgt0 mgb0"><span class="fl">Refine your search&nbsp;</span><img width="20" height="20" class="fl" src="<?php echo base_url(); ?>public/images/iconsearch.png"></h3>
      <h3 class="bgr_orange white txt_indent10 ff_museo500 f15 item pdt6 pdb5 mgt13 mgb3 lighter">Style</h3>
      <div class="item pdt4">
        <input type="checkbox" value="Fine dining" id="style1" onclick="searchbyrestaurant('style1')" class="fl mgl10 mgt1">
        Fine dining</div>
      <div class="item">
        <input type="checkbox" value="Family" id="style2" onclick="searchbyrestaurant('style2')" class="fl mgl10 mgt1">
        Family</div>
      <div class="item">
        <input type="checkbox" value="Couple" id="style3" onclick="searchbyrestaurant('style3')" class="fl mgl10 mgt1">
        Couple</div>
      <div class="item">
        <input type="checkbox" value="Group" id="style4" onclick="searchbyrestaurant('style4')" class="fl mgl10 mgt1">
        Group</div>
      <h3 class="bgr_orange white txt_indent10 ff_museo500 f15 item pdt6 pdb5 mgt13 mgb3 lighter">Cuisine</h3>
      <div class="item pdt4">
        <input type="checkbox" value="Myanmar" id="cuisine1" onclick="searchbyrestaurant('cuisine1')" class="fl mgl10 mgt1">
        Myanmar</div>
      <div class="item">
        <input type="checkbox" value="Western" id="cuisine2" onclick="searchbyrestaurant('cuisine2')" class="fl mgl10 mgt1">
        Western</div>
      <div class="item">
        <input type="checkbox" value="Chinese" id="cuisine3" onclick="searchbyrestaurant('cuisine3')" class="fl mgl10 mgt1">
        Chinese</div>
      <div class="item">
        <input type="checkbox" value="Asian" id="cuisine4" onclick="searchbyrestaurant('cuisine4')" class="fl mgl10 mgt1">
        Asian</div>
      <div class="item">
        <input type="checkbox" value="Thai" id="cuisine5" onclick="searchbyrestaurant('cuisine5')" class="fl mgl10 mgt1">
        Thai</div>
      <h3 class="bgr_orange white txt_indent10 ff_museo500 f15 item pdt6 pdb5 mgt8 mgb3 lighter">Meal</h3>
      <div class="item pdt4">
        <input type="checkbox" value="Breakfast" id="meal1" onclick="searchbyrestaurant('meal1')" class="fl mgl10 mgt1">
        Breakfast</div>
      <div class="item">
        <input type="checkbox" value="Lunch" id="meal2" onclick="searchbyrestaurant('meal2')" class="fl mgl10 mgt1">
        Lunch</div>
      <div class="item">
        <input type="checkbox" value="Snack" id="meal3" onclick="searchbyrestaurant('meal3')" class="fl mgl10 mgt1">
        Snack</div>
      <div class="item">
        <input type="checkbox" value="Dinner" id="meal4" onclick="searchbyrestaurant('meal4')" class="fl mgl10 mgt1">
        Dinner</div>
      <a href="#" class="fl pdl10 blue undeline mgb10 mgt7">Need help for the booking call us</a> </div>
  </div>
  <img width="100%" class="fl mgt5" src="<?php echo base_url(); ?>public/images/rightbanner_03.png"> <img width="100%" class="fl mgt5" src="<?php echo base_url(); ?>public/images/rightbanner_03.png"> </div>
<script>
	var listroomhotel=Array();
	
	for(var i=1;i<=1000;i++){		
		listroomhotel[i]=false;		
	}
	listroomhotel[1]=true;
	$(function() {
		var restaurant_namesearch = [
		<?php echo $restaurant_namesearch; ?>
		];
		$("#restaurant_namesearch").autocomplete({
		source: restaurant_namesearch
		});
	});		
	
	var postdata={<?php if(isset($_GET['provide'])) echo "provide:'".$_GET['provide']."'";
						else if(isset($_GET['name']))echo "name:'".$_GET['name']."'";
						if(isset($_GET['sortby'])) echo ",sortby:'".$_GET['sortby']."'";
						if(isset($_GET['style'])) echo ",style:'".$_GET['style']."'"; 
						if(isset($_GET['cuisine'])) echo ",cuisine:'".$_GET['cuisine']."'";
						if(isset($_GET['meal'])) echo ",meal:'".$_GET['meal']."'";
						if(isset($_GET['pagenumber'])) echo ",pagenumber:'".$_GET['pagenumber']."'";?>};
	$(document).ready(function(){
		$('#restaurant_namesearch').val(null);	
		for(var i=0;i<1000;i++){
		if($('#style'+i).is(':checked')==true){
			$('#style'+i).attr('checked', false);
		};
		if($('#cuisine'+i).is(':checked')==true){
			$('#cuisine'+i).attr('checked', false);
		};
		if($('#meal'+i).is(':checked')==true){
			$('#meal'+i).attr('checked', false);
		};
	}
	});
	var style=Array();
	var cuisine=Array();
	var meal=Array();
	<?php if(isset($_GET['style'])){?>
		style.push('<?php echo $_GET['style'];?>');
	<?php }if(isset($_GET['cuisine'])){?>
		cuisine.push('<?php echo $_GET['cuisine'];?>');
	<?php }if(isset($_GET['meal'])){?>
		meal.push('<?php echo $_GET['meal'];?>');
	<?php }?>
	
	$('#btnsearch_restaurant_name').click(function(){
			if($('#restaurant_namesearch').val()==""){				
				$('#restaurant_namesearch').addClass('bxshadow_ff0000');
				return false;
			}else{
				for(var r=1;r<=8;r++){
					if($('#style'+r).is(':checked')==true){
						style.push($('#style'+r).val());			
					}else{	
						var check=-1;
						for(var i=0;i<style.length;i++){
							if(style[i]==$('#style'+r).val()){
								check=i;						
							}	
						}
						style.splice(check,1);
					}

					if($('#cuisine'+r).is(':checked')==true){
						cuisine.push($('#cuisine'+r).val());			
					}else{	
						var check=-1;
						for(var i=0;i<cuisine.length;i++){
							if(cuisine[i]==$('#cuisine'+r).val()){
								check=i;						
							}	
						}
						cuisine.splice(check,1);
					}

					if($('#meal'+r).is(':checked')==true){
						meal.push($('#meal'+r).val());			
					}else{	
						var check=-1;
						for(var i=0;i<meal.length;i++){
							if(meal[i]==$('#meal'+r).val()){
								check=i;						
							}	
						}
						meal.splice(check,1);
					}								
				}
				postdata.style=style;	
				postdata.cuisine=cuisine;
				postdata.meal=meal;
				postdata.sortby=$('#sortby').val();
				postdata.name=$('#restaurant_namesearch').val();
				$.get('<?php echo base_url(); ?>home/ajax/getajax_restaurant_search_result',postdata,function(data){						
					$('#boxoutsize').html(data);
				});	 	
			}
		});
		$('#hotel_name').click(function(){
			$(this).removeClass('bxshadow_ff0000');							
		})
	
	function searchbyrestaurant(number){
		for(var r=1;r<=8;r++){
			if(number=="style"+r){
				if($('#'+number).is(':checked')==true){
					style.push($('#'+number).val());			
				}else{	
					var check=-1;
					for(var i=0;i<style.length;i++){
						if(style[i]==$('#'+number).val()){
							check=i;						
						}	
					}
					style.splice(check,1);
				}
			}
			
			if(number=="cuisine"+r){
				if($('#'+number).is(':checked')==true){
					cuisine.push($('#'+number).val());			
				}else{	
					var check=-1;
					for(var i=0;i<cuisine.length;i++){
						if(cuisine[i]==$('#'+number).val()){
							check=i;						
						}	
					}
					cuisine.splice(check,1);
				}
			}
			if(number=="meal"+r){
				if($('#'+number).is(':checked')==true){
					meal.push($('#'+number).val());			
				}else{	
					var check=-1;
					for(var i=0;i<meal.length;i++){
						if(meal[i]==$('#'+number).val()){
							check=i;						
						}	
					}
					meal.splice(check,1);
				}
			}			
		}
		postdata.style=style;	
		postdata.cuisine=cuisine;
		postdata.meal=meal;
		postdata.sortby=$('#sortby').val();
		
		$.get('<?php echo base_url(); ?>home/ajax/getajax_restaurant_search_result',postdata,function(data){						
			$('#boxoutsize').html(data);
		});	 
	}
</script>
